package com.example.academicsystem.server.controller.teacher;

import com.example.academicsystem.pojo.dto.CourseDto;
import com.example.academicsystem.pojo.dto.GradeDto;
import com.example.academicsystem.pojo.dto.GradeInsertDto;
import com.example.academicsystem.pojo.dto.TeacherGradeUpdateDto;
import com.example.academicsystem.result.PageResult;
import com.example.academicsystem.result.Result;
import com.example.academicsystem.server.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/teacher/grade")
@Slf4j
public class TeacherGradeController {
    @Autowired
    private TeacherService teacherService;

    @PostMapping("/page")
    public Result<PageResult> teacherGradePageQuery(@RequestBody GradeDto gradeDto){
        log.info("teacherGradePageQuery");
        PageResult pageResult= teacherService.teacherGradePageQuery(gradeDto);
        return Result.success(pageResult);
    }
    @PostMapping("/insert")
    public Result teacherGradeInsert(@RequestBody GradeInsertDto gradeInsertDto){
        log.info("teacherGradeInsert");
        teacherService.teacherGradeInsert(gradeInsertDto);
        return Result.success();
    }

    @PutMapping("/update")
    public Result teacherGradeUpdate(@RequestBody TeacherGradeUpdateDto teacherGradeUpdateDto){
        log.info("teacherGradeUpdate");
        teacherService.teacherGradeUpdate(teacherGradeUpdateDto);
        return Result.success();
    }
}
